package com.tsky.system.entity;

import java.sql.Timestamp;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * 
 * @function：菜单
 * @author: cainiao
 * @version 1.0 
 * @time: 2011-12-15 上午10:22:13
 */
@Entity
@Table(name = "t_SYS_MENU")
public class Menu {

	@Id
	private String id;
	private String name;
	private String status = "1";
	private Timestamp createTime;

	private String property = "0";// 是否存在子菜单0：不存在，1：存在，layerNO可删除
	private String url;// linkPage
	private String icon;
	private int orderNO;

	/* realatioship */
	@ManyToOne
	@JoinColumn(name="pid")
	private Menu parent;
	
	@OneToMany(mappedBy="parent")
	private Set<Menu> childs;
	
	@ManyToMany
	@JoinTable(name="t_SYS_ROLEMENU", joinColumns={@JoinColumn(name="MENUID")},   
			  inverseJoinColumns={@JoinColumn(name="ROLEID")})
	private Set<Role> roles;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Timestamp getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Timestamp createTime) {
		this.createTime = createTime;
	}

	public String getProperty() {
		return property;
	}

	public void setProperty(String property) {
		this.property = property;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getIcon() {
		return icon;
	}

	public void setIcon(String icon) {
		this.icon = icon;
	}

	public int getOrderNO() {
		return orderNO;
	}

	public void setOrderNO(int orderNO) {
		this.orderNO = orderNO;
	}

	public Menu getParent() {
		return parent;
	}

	public void setParent(Menu parent) {
		this.parent = parent;
	}

	public Set<Menu> getChilds() {
		return childs;
	}

	public void setChilds(Set<Menu> childs) {
		this.childs = childs;
	}

	public Set<Role> getRoles() {
		return roles;
	}

	public void setRoles(Set<Role> roles) {
		this.roles = roles;
	}

}
